package com.drumbeatinsight.data
{
	import mx.formatters.Formatter;
	
	public class DataField
	{
		// default value of the field
		// if it is not set then the value is an empty string
		// if the field is a custom field then the default value of that field is null
		// to set it to empty string then define this field as an empty string
		public var defaultValue:String;
		
		// field being on the blog entry
		public var dataField:String = "";
		
		// optional formatter used to format the value
		public var formatter:Formatter;
		
		// optional formats the value in flash compatible html
		public var formatAsHTML:Boolean = false;
		
	    // function used to let the user define the string
	    private var _labelFunction:Function;
	    
	    // parse the string and find the path to the image
	    public var findImagePath:Boolean = false;
	    
	    // parse the string and find the source markup of the image
	    public var findImageTag:Boolean = false;

	   /**
	     *  A function that determines the text to display in this column.  By default
	     *  the column displays the text for the field in the data that matches the
	     *  column name.  However, sometimes you want to display text based on
	     *  more than one field in the data, or display something that does not
	     *  have the format that you want.
	     *  In such a case you specify a callback function using <code>labelFunction</code>.
	     *  This function is called after every other formatting option you've defined.
	     *
	     *  <p>The method signature has the following form:</p>
	     *
	     *  <pre>labelFunction(item:BlogPost, originalValue:String, currentFormattedValue:String):String</pre>
	     *
	     *  <p>Where <code>item</code> contains the BlogPost item object, and
	     *  <code>column</code> specifies the field column.</p>
	     *
	     *  <p>A callback function might concatenate the firstName and
	     *  lastName fields in the data, or do some custom formatting on a Date,
	     *  or convert a number for the month into the string for the month.</p>
	     */
	    public function get labelFunction():Function {
	        return _labelFunction;
	    }
	
	    /**
	     *  @private
	     */
	    public function set labelFunction(value:Function):void {
	        _labelFunction = value;
	    }
	}
}